#include <iostream>
#include <stack>
#include <string>   
using namespace std;
int main(){
    char c;
    string word;
    stack<string> stack1;
    c=getchar();
    
    while (c!='\n'){
        if ((('a'<=c)&&(c<='z'))||(('A'<=c)&&(c<='Z'))){
            word+=c;
            
        }else{
            if (word.length()!=0){
            stack1.push(word);
            word.clear();}
        }
        c=getchar();

    }
    stack1.push(word);
    while (!stack1.empty()){
        cout<<stack1.top();
        stack1.pop();   
        if (!stack1.empty())cout<<' ';
                
    }
     
  

    return 0;
}